﻿<%@ Page Language="C#" MasterPageFile="~/webui/admin/adminTemplate.master" AutoEventWireup="true"
    CodeFile="admin_company.aspx.cs" Inherits="admin_company" Title=".::E-Valuation System::.." %>

<%@ Register Src="~/uicontrol/Calendar.ascx" TagName="Calendar" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">

<div class="tabbable">  
                                                <%

                                String tab1 = "";
                                String tab2 = "";
                                 String tab3 = "";
                                if (getSelectedTab().Equals("0"))
                                {
                                    tab1 = "active";
                                    tab2 = "";
                                     tab3 = "";
                                }

                                
                                if (getSelectedTab().Equals("1"))
                                {
                                    tab2 = "active";
                                     tab1 = "";
                                      tab3 = "";
                                }

                               
                                if (getSelectedTab().Equals("2"))
                                {
                                    tab3 = "active";
                                    tab2 = "";
                                     tab1 = "";
                                }
                            %>
                      <ul class="nav nav-tabs">
                        <li class="<%=tab1%>">
                        <asp:LinkButton data-toggle="tab1"  ID="TabValue0" runat="server" CausesValidation="false"
                                                                    OnClick="ChangeTabIndex">
                                                                 Danh sách doanh nghiệp
                                                                </asp:LinkButton>
                        </li>
                        <li class="<%=tab2 %>">
                        <asp:LinkButton data-toggle="tab2"  ID="TabValue1" runat="server" CausesValidation="false"
                                                                    OnClick="ChangeTabIndex">
                                                                 Cấp phép cho doanh nghiệp
                                                                </asp:LinkButton>
                        </li>

                         <li class="<%=tab3%>">
                        <asp:LinkButton data-toggle="tab3"  ID="TabValue2" runat="server" CausesValidation="false"
                                                                    OnClick="ChangeTabIndex">
                                                                 Thao tác doanh nghiệp
                                                                </asp:LinkButton>
                        </li>
                      </ul>
   </div>   


    <div class="tab-content">
                        <div class="tab-pane  <%=tab1%>" id="tab1">
                            <asp:Panel ID="Panel0" runat="server">
                                    
                                        <asp:GridView ID="grvCoLst" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                                            DataKeyNames="MaDoanhNghiep" DataSourceID="doanhnghiepData" PageSize="10" OnRowDataBound="grvCoLst_RowDataBound"
                                            OnPageIndexChanging="grvCoLst_PageIndexChanging" OnRowCommand="grvCoLst_RowCommand"
                                            class="table">
                                            <Columns>
                                                <asp:BoundField DataField="TenDoanhNghiep" HeaderText="Tên Doanh nghiệp" />
                                                <asp:BoundField DataField="ChucNang" HeaderText="Lĩnh vực">
                                                    <HeaderStyle Width="50%" />
                                                </asp:BoundField>
                                                <asp:BoundField DataField="NamThanhLap" HeaderText="Thành lập" Visible="false"></asp:BoundField>
                                                <asp:BoundField DataField="WebSite" HeaderText="Trang chủ" Visible="false"></asp:BoundField>
                                                <asp:BoundField DataField="DiaChi" HeaderText="Địa chỉ" Visible="false" />
                                                <asp:BoundField DataField="Email" HeaderText="Thư điện tử" Visible="false"></asp:BoundField>
                                                <asp:TemplateField HeaderText="Chức năng">
                                                    <ItemTemplate>
                                                        <asp:ImageButton ID="edit" CommandArgument='<%# Eval("MaDoanhNghiep") %>' CommandName="Sua"
                                                            runat="server" ImageUrl="~/App_Themes/Default/Css/images/edit.gif" CausesValidation="false"
                                                            AlternateText="Sửa lại thông tin của Doanh nghiệp" />
                                                        <asp:ImageButton ID="delete" CommandArgument='<%# Eval("MaDoanhNghiep") %>' CommandName="Xoa"
                                                            runat="server" ImageUrl="~/App_Themes/Default/Css/images/delete.gif" CausesValidation="false"
                                                            AlternateText="Xóa Doanh nghiệp này" />
                                                    </ItemTemplate>
                                                    <ItemStyle HorizontalAlign="Center" />
                                                </asp:TemplateField>
                                            </Columns>
                                             
                                        </asp:GridView>
                                        <asp:SqlDataSource runat="server" ID="doanhnghiepData" SelectCommand="select * from doanhnghiep"
                                            ConnectionString="<%$ConnectionStrings:evaConn %>"></asp:SqlDataSource>
                                    
                            </asp:Panel>
                        </div>

                         <div class="tab-pane  <%=tab2%>" id="tab2">
                            <asp:Panel runat="server" ID="CapPhepPanle" CssClass="UITabContentReg">
                                    <div class="RegCompanyList">
                                        <asp:DataGrid ID="RegCompanyListView" CssClass="RegCompanyGrid" DataSourceID="RegCompanyData"
                                            runat="server" AllowPaging="True" AutoGenerateColumns="False" DataKeyField="idguest"
                                            OnEditCommand="companySelectCommand" PageSize="10">
                                            <Columns>
                                                <asp:BoundColumn DataField="idguest" Visible="false"></asp:BoundColumn>
                                                <asp:BoundColumn DataField="tencongty" HeaderText="Danh sách công ty"></asp:BoundColumn>
                                                <asp:EditCommandColumn EditText="Xem" HeaderText="Thao tác"></asp:EditCommandColumn>
                                            </Columns>
                                        </asp:DataGrid>
                                        <asp:HiddenField ID="makhach" runat="server" Value="0" />
                                        <asp:SqlDataSource runat="server" ID="RegCompanyData" ConnectionString="<%$ ConnectionStrings:evaConn %>"
                                            SelectCommand="select idguest, tencongty from guest where dacapphep = '0'"></asp:SqlDataSource>
                                    </div>
                                    <div class="RegCompanyInfo">
                                        <asp:Repeater runat="server" ID="rp_detail" DataSourceID="detailData">
                                            <ItemTemplate>
                                                <div class="FieldContainer">
                                                    <label>
                                                        Logo:</label>
                                                    <img width="100px" height="100px" alt='<%#Eval("tencongty") %>' src='<%#Eval("logo") %>' />
                                                    <asp:HiddenField ID="HiddenField1" runat="server" Value='<% #Eval("logo")%>' />
                                                </div>
                                                <div class="FieldContainer">
                                                    <label>
                                                        Tên công ty:</label>
                                                    <%#Eval("tencongty") %>
                                                    <asp:HiddenField ID="HiddenField2" runat="server" Value='<% #Eval("tencongty")%>' />
                                                </div>
                                                <div class="FieldContainer">
                                                    <label>
                                                        Người đăng ký:</label>
                                                    <%#Eval("hovaten") %>
                                                    <asp:HiddenField ID="HiddenField3" runat="server" Value='<% #Eval("idguest")%>' />
                                                </div>
                                                <div class="FieldContainer">
                                                    <label>
                                                        Năm thành lập:</label>
                                                    <%#Eval("namthanhlap") %>
                                                    <asp:HiddenField ID="HiddenField4" runat="server" Value='<% #Eval("namthanhlap")%>' />
                                                </div>
                                                <div class="FieldContainer">
                                                    <label>
                                                        Ngành nghề:</label>
                                                    <%#Eval("linhvuckinhdoanh") %>
                                                    <asp:HiddenField ID="HiddenField5" runat="server" Value='<% #Eval("linhvuckinhdoanh")%>' />
                                                </div>
                                                <div class="FieldContainer">
                                                    <label>
                                                        Địa chỉ:</label>
                                                    <%#Eval("diachi") %>
                                                     <asp:HiddenField ID="HiddenField6" runat="server" Value='<% #Eval("diachi")%>' />
                                                </div>
                                                <div class="FieldContainer">
                                                    <label>
                                                        Điện thoại:</label>
                                                    <%#Eval("dienthoai") %>
                                                    <asp:HiddenField ID="HiddenField7" runat="server" Value='<% #Eval("dienthoai")%>' />
                                                </div>
                                                <div class="FieldContainer">
                                                    <label>
                                                        Hộp thư:</label>
                                                    <%#Eval("hopthu") %>
                                                      <asp:HiddenField ID="HiddenField8" runat="server" Value='<% #Eval("hopthu")%>' />
                                                </div>
                                            </ItemTemplate>
                                        </asp:Repeater>
                                        <asp:SqlDataSource ID="detailData" runat="server" ConnectionString="<%$ ConnectionStrings:evaConn %>"
                                            SelectCommand="select * from guest where  idguest=@khachid">
                                            <SelectParameters>
                                                <asp:ControlParameter Name="khachid" ControlID="makhach" PropertyName="Value" />
                                            </SelectParameters>
                                        </asp:SqlDataSource>
                                        <div class="ActionButtons">
                                            <asp:Button runat="server" Text="Cấp phép" CausesValidation="false" ID="btn_permiss"
                                                OnClick="btn_permiss_click" />
                                        </div>
                                    </div>
                                    <div class="ClearLeft">
                                        <span></span>
                                    </div>
                            </asp:Panel>
                        </div>

                         <div class="tab-pane  <%=tab3%>" id="tab3">
                            <asp:Panel ID="Panel1" runat="server">
                                    <div class="form-horizontal">
                                        
                                        <div class="control-group" style="display:none;">        
         <label class="control-label" for="txt_comId">
                                                ID</label>
                                                <div class="controls">
                                            <asp:TextBox runat="server" ID="txt_comId"></asp:TextBox>
                                                </div>
                                        </div>

                                        <div class="control-group">        
         <label class="control-label" for="txt_compten">
                                                Tên công ty</label>
                                                 <div class="controls">
                                            <textarea rows="2" cols="10" id="txt_compten" runat="server" class="Textarea"></textarea>
                                                </div>
                                        </div>

                                        <div class="control-group">        
         <label class="control-label" for="txt_complinhvuc">
                                                Lĩnh vực kinh doanh</label>
                                                 <div class="controls">
                                            <textarea rows="2" cols="10" id="txt_complinhvuc" runat="server" class="Textarea"></textarea>
                                             </div>
                                        </div>
                                         <div class="control-group">        
         <label class="control-label" for="Calendar1">
                                                Năm thành lập</label>
                                                <div class="controls">
                                            <uc1:calendar id="Calendar1" runat="server" />
                                            </div>
                                        </div>

                                         <div class="control-group">        
         <label class="control-label" for="txt_trangchu">
                                              
                                                Trang chủ</label>
                                                <div class="controls">
                                            <asp:TextBox ID="txt_trangchu" runat="server" CssClass="Input" MaxLength="255"></asp:TextBox>
                                            <asp:RegularExpressionValidator ID="revWebsite" runat="server" CssClass="ValidateLabel"
                                                ErrorMessage="Địa chỉ chưa chính xác." ValidationExpression="http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?"
                                                ControlToValidate="txt_trangchu"></asp:RegularExpressionValidator>
                                                 </div>
                                        </div>

                                         <div class="control-group">        
         <label class="control-label" for="txt_diachi">
                                                Địa chỉ</label>
                                              <div class="controls">  
                                            <textarea rows="5" cols="10" id="txt_diachi" runat="server" class="Textarea"></textarea>
                                             </div>
                                        </div>

                                        <div class="control-group">        
         <label class="control-label" for="txt_homthu">
                                                Hòm thư</label>
                                                <div class="controls">  
                                            <asp:TextBox ID="txt_homthu" runat="server" CssClass="Input" MaxLength="255"></asp:TextBox>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txt_homthu"
                                                ErrorMessage="Không được trống" CssClass="ValidateLabel" Display="Dynamic"></asp:RequiredFieldValidator>
                                            <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txt_homthu"
                                                ErrorMessage="Địa chỉ không chính xác" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
                                                CssClass="ValidateLabel" Display="Dynamic"></asp:RegularExpressionValidator>
                                            <asp:Label ID="lblEmailNotify" CssClass="ValidateLabel" Text="Hòm thư này đã được đăng ký"
                                                runat="server" Visible="false"></asp:Label>
                                            </div>
                                        </div>

                                        <div class="control-group">        
         <label class="control-label" for="txt_dienthoai">
                                                Điện thoại</label>
                                                <div class="controls"> 
                                            <asp:TextBox ID="txt_dienthoai" runat="server" CssClass="Input" MaxLength="15"></asp:TextBox>
                                             
                                            </div>
                                        </div>
                                        
                                        <div class="control-group">       
                                            <label class="control-label" ></label>
                                             <div class="controls">   

                                            <asp:Button ID="btn_Save" class="btn btn-primary" Text="Ghi lại" runat="server" OnClick="btn_Save_Click" />
                                            <asp:Button ID="btn_Reset"  class="btn" Text="Làm lại" runat="server" CausesValidation="False"
                                                OnClick="btn_Reset_Click" />
                                                 </div>
                                        </div>
                                    </div>
                            </asp:Panel>   
                        </div>
      </div> 

 
</asp:Content>
